﻿using System;
using System.Collections.Generic;
using System.Data.OleDb;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using Common;

namespace Print
{
    public partial class Show : PrintPageBase
    {
        private PBLL.PMenu bllMenu = new PBLL.PMenu();
        private PBLL.PService bllService = new PBLL.PService();
        private PBLL.PShow bllShow = new PBLL.PShow();
        public string mid = "2";
        public string title = "";

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                title = config.P_Title;
                menuRpt.DataSource = bllMenu.GetList("MShow=true");
                OleDbDataReader dr = bllMenu.GetDr("MUrl='show.aspx'");
                if (dr.Read())
                {
                    mid = dr["Id"].ToString();
                    pos.InnerText = "您的位置：" + dr["MTitle"].ToString();
                    GetAd(AdRpt, dr["MTitle"].ToString());
                    title = dr["MTitle"].ToString() + "-" + config.P_Name;
                }
                dr.Close();
                dr = bllService.GetList();
                int i = 0;
                string txt = "\n<div>\n<ul>\n";
                while (dr.Read())
                {
                    i++;
                    txt += "<li class=\"fixpng\"><a href=\"" + config.P_WebPath + "/items/" + dr["Id"].ToString() + ".aspx\"><img src=\"" + config.P_WebPath + dr["SPic"].ToString() + "\" width=\"129\" height=\"85\" alt=\"" + dr["Stitle"].ToString() + "\" /></a></li>\n";
                    if (i % 6 == 0)
                    {
                        txt += "</ul>\n</div>\n<div>\n<ul>\n";
                    }
                }
                txt += "</ul>\n</div>\n";
                items.InnerHtml = txt;
                ShowRpt.DataSource = bllShow.GetList();
                Page.DataBind();
            }
        }
    }
}